using System;
using System.Collections.Generic;
using System.Text;
using Photogrammetry.Transformation;
using Geometry;

namespace Photogrammetry.Transformation
{
    /// <summary>
    /// This class is an example on how the projective class should be used. When compiling the solution this class should be deleted and the project type must be changed to class library.
    /// </summary>
    /// <remarks>As this class is deleted and project type is changed compilation will create a dll file. This library should be used easily as it is used in this class.</remarks>
    class Tester
    {
        /// <summary>
        /// Main Function to be run when compiled as a console exe
        /// </summary>
        static void Main(string[] args)
        {
            #region declarations
            Point[] pictureVertices = new Point[7];
            Point[] realVertices = new Point[7];
            pictureVertices[0] = new Point();
            pictureVertices[1] = new Point();
            pictureVertices[2] = new Point();
            pictureVertices[3] = new Point();
            pictureVertices[4] = new Point();
            pictureVertices[5] = new Point();
            pictureVertices[6] = new Point();
            realVertices[0] = new Point();
            realVertices[1] = new Point();
            realVertices[2] = new Point();
            realVertices[3] = new Point();
            realVertices[4] = new Point();
            realVertices[5] = new Point();
            realVertices[6] = new Point();
            #endregion

            #region pictureVertices
            pictureVertices[0].X = 5208.79;
            pictureVertices[1].X = 4833.49;
            pictureVertices[2].X = 5000.00;
            pictureVertices[3].X = 5166.91;
            pictureVertices[4].X = 5039.38;
            pictureVertices[5].X = 5050.71;
            pictureVertices[6].X = 4878.09;

            pictureVertices[0].Y = 5043.74;
            pictureVertices[1].Y = 5218.42;
            pictureVertices[2].Y = 5000.00;
            pictureVertices[3].Y = 5220.02;
            pictureVertices[4].Y = 5242.70;
            pictureVertices[5].Y = 5106.17;
            pictureVertices[6].Y = 5066.86;
            #endregion

            #region realVertices
            realVertices[0].X = 494068.83;
            realVertices[1].X = 491115.60;
            realVertices[2].X = 492553.38;
            realVertices[3].X = 493597.03;
            realVertices[4].X = 492626.70;
            realVertices[5].X = 492834.82;
            realVertices[6].X = 491584.95;

            realVertices[0].Y = 244618.72;
            realVertices[1].Y = 245579.41;
            realVertices[2].Y = 244103.98;
            realVertices[3].Y = 245893.38;
            realVertices[4].Y = 245946.69;
            realVertices[5].Y = 244940.44;
            realVertices[6].Y = 244491.45;
            #endregion

            //Projective x = new Projective(pictureVertices, realVertices);
            //Point[] newVertices = x.Transform(pictureVertices);
            //Console.WriteLine("------------------------------------");
            //for (int i = 0; i<newVertices.GetLength(0); i++)
            //{
            //    Console.Write(newVertices[i].X);
            //    Console.Write("----");
            //    Console.WriteLine(newVertices[i].Y);
            //}
            //Console.ReadKey(); 

            Affine x = new Affine(pictureVertices, realVertices);
            Point[] newVertices = x.Transform(pictureVertices);
            Console.WriteLine("------------------------------------");
            for (int i = 0; i < newVertices.GetLength(0); i++)
            {
                Console.Write(newVertices[i].X);
                Console.Write("----");
                Console.WriteLine(newVertices[i].Y);
            }
            Console.ReadKey();
        }
    }
}
